package com.cssw.fyzb.wap.controller;

import com.cssw.fyzb.base.web.domain.AjaxData;
import com.cssw.fyzb.wap.model.vo.ParamVo;
import com.cssw.fyzb.wap.model.vo.SdkInfoVo;
import com.cssw.fyzb.wap.service.SysParamService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author Feng Chen
 */
@Controller
@RequestMapping("/system")
public class SystemController {

    @Autowired
    private SysParamService sysParamService;

    @ApiOperation(value = "查询腾讯sdk信息")
    @RequestMapping(value = "/sdkInfo", method = RequestMethod.GET)
    @ResponseBody
    public AjaxData<SdkInfoVo> data() {
        return sysParamService.getSdkInfo();
    }

    @ApiOperation(value = "查询系统参数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "key", paramType = "query", dataType = "string", required = true),
            @ApiImplicitParam(name = "force", value = "是否强制刷新 0否 1是", paramType = "query", dataType = "string", required = false),
    })
    @GetMapping(value = "/getParam")
    @ResponseBody
    public AjaxData<ParamVo> getParam(String name, String force) {
        return sysParamService.getParam(name, force);
    }

}
